<?php
namespace Transform;

class GoodsTransform extends Transform
{
    public function listview()
    {
        return [
            'allows' => ['goods_id', 'title', 'cate_id', 'shop_id', 'photo', 'price','mall_price', 'views', 'sold_num', 'shop', 'cate', 'comments_count', 'monthly_sales_count', 'sale_type', 'expired_in'],
            'shop' => [
                'trans' => ['name' => 'Shop', 'method' => 'listview']
            ],
            'cate' => [
                'trans' => ['name' => 'GoodsCate', 'method' => 'listview'],
            ]
        ];
    }

    public function detail()
    {
        return [
            'allows' => ['goods_id', 'title', 'cate_id', 'shop_id', 'photo', 'price', 'views', 'sold_num', 'details', 'shop', 'cate', 'details', 'comments_count', 'monthly_sales_count','collected','sale_type', 'expired_in'],
            'shop' => [
                'trans' => ['name' => 'Shop', 'method' => 'detail']
            ],
            'cate' => [
                'trans' => ['name' => 'GoodsCate', 'method' => 'listview'],
            ]
        ];
    }

    public function simple()
    {
        return [
            'allows' => ['goods_id', 'title', 'cate_id', 'shop_id', 'photo', 'price', 'views', 'sold_num', 'details', 'shop', 'cate', 'comments_count', 'monthly_sales_count', 'sale_type', 'expired_in'],
        ];
    }

    public function cart()
    {
        return [
            'allows' => ['goods_id', 'title', 'cate_id', 'shop_id', 'photo', 'price', 'views', 'sold_num', 'shop', 'cate', 'comments_count', 'monthly_sales_count', 'quantity', 'sale_type', 'expired_in'],
            'cate' => [
                'trans' => ['name' => 'GoodsCate', 'method' => 'listview'],
            ],
            'product_is_choosed' => ['value' => 0],
        ];
    }
}
